What does this statement mean ? printf("[%.*s] ", (int) lengths[i],
Posted
by
Vivek Goel
on Stack Overflow
See other posts from Stack Overflow
or by Vivek Goel
Published on 2011-03-14T08:07:06Z
Indexed on
2011/03/14
8:10 UTC
Read the original article
Hit count: 173
I was reading this page http://dev.mysql.com/doc/refman/5.0/en/mysql-fetch-row.html there is one line
printf("[%.*s] ", (int) lengths[i],
row[i] ? row[i] : "NULL");
from code
MYSQL_ROW row;
unsigned int num_fields;
unsigned int i;
num_fields = mysql_num_fields(result);
while ((row = mysql_fetch_row(result)))
{
unsigned long *lengths;
lengths = mysql_fetch_lengths(result);
for(i = 0; i < num_fields; i++)
{
printf("[%.*s] ", (int) lengths[i],
row[i] ? row[i] : "NULL");
}
printf("\n");
}
what does [%.*s]
mean in that code ?
© Stack Overflow or respective owner